package com.wjs.gulimall.gulimallmember.web;

import com.atguigu.common.utils.R;
import com.atguigu.common.vo.MemberRespVo;
import com.wjs.gulimall.gulimallmember.feign.OrderFeignService;
import com.wjs.gulimall.gulimallmember.interceptor.LoginUserInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.HashMap;
import java.util.Map;

@Controller
public class MemberWebController {

    @Autowired
    private OrderFeignService orderFeignService;
    @GetMapping("/memberOrder.html")
    public String memberOrder(@RequestParam(value = "pageNum",defaultValue = "1") Integer pageNum,
                              Model model){
        MemberRespVo member = LoginUserInterceptor.loginUser.get();
        Map<String,Object> param=new HashMap<>();
        param.put("page",pageNum);
        R r = orderFeignService.listWithItem(param);
        model.addAttribute("orders",r);
        return "memberOrder";
    }
}
